package oop6;

import java.util.InputMismatchException;
import java.util.Scanner;

/**
 * @author oldliu
 * @since 1.0
 */
public class Caculator {
    public int div(int a,int b)throws Exception{
        int c=a/b;
        return c;
    }
    //除法
    public int chu(int a,int b) throws Exception {
        if(b==0)
            throw new Exception("除数不能是0");
        int c=a/b;
        return c;
    }
    public int chu2(int a,int b) throws Exception, InputMismatchException {
       try {
           int c = a / b;
           return c;
       }catch (Exception e){
           e.printStackTrace();
           throw  new Kgc79Exception(e);//!!!!!!!!!!!!
           //throw  new Kgc79Exception("除法异常！");//丢失异常的详细信息
       }
       //return 0
    }
    //除法！！！
    public int chu3() throws ArithmeticException, InputMismatchException {
        Scanner in=new Scanner(System.in);
        System.out.println("input a and b:");
        int a=in.nextInt();
        int b=in.nextInt();
        int c=a/b;
        return c;
    }
}
